/**
 * 
 */
package com.uit.project.bustrip.dao;

import org.json.JSONException;
import org.json.JSONObject;
import android.util.Log;

import com.uit.project.bustrip.daointerface.CustomerDao;
import com.uit.project.bustrip.database.DBHelper;
import com.uit.project.bustrip.entity.Customer;
/**
 * @author 
 *
 */
public class CustomerDaoImpl extends BaseDaoImpl<Customer, Integer> implements CustomerDao {

	public CustomerDaoImpl(){
		super();
	}
	public CustomerDaoImpl(DBHelper db) {
		super(db);
	}
	@Override
	public Customer getFromJSON(JSONObject json) {
		try {
			Customer item = new Customer();
			item.id = json.getInt("id");
			item.code = json.getString("code");
			item.username = json.getString("username");
			item.password = json.getString("password");
			item.numberphone = json.getString("numberphone");
			item.address = json.getString("address");
			item.email = json.getString("email");
			item.image = json.getString("image");
			item.updatetime = json.getString("updatetime");
			item.latitude = json.getInt("latitude");
			item.longtitude = json.getInt("longtitude");
			item.status = json.getInt("status");
			return item;
		} catch (JSONException e) {
			Log.i("CustomerDaoImpl",e.getMessage());
			return null;
		}
	}
}
